refactored, testing