refactored, still need to fix