included support for select + some refactoring