refactored everything