Can now select entities. This needs a LOT of work to make the code pretty.