implemented select, needs testing.