start refactoring files, adding tests