Cleaned up, and speeded up the selector engine