pre refactored