added tests, refactoring tests, automatically refromat with IntelliJ