done initial refactoring