move tests to tests subdir & refactoring