major refactoring: changed the project structure, added tests