initial implementation of select