Move main files to lib.
Add example queries.
Add executable.
Add basic tests.
Remove unused terminals.