refactoring packages + unit tests