Moved the bulk of the selector code out into a separate file, changed the build files...