cleaned up selector code