refactored, tests cleanup