finished refactor, testing