partial implementation of query insert methods, unit tests
more refactoring
unit tests