needs fix, refactored