refactored one (compile passed)