A solution to the selector code challenge