Dev

* Add tests
* Fix queries