refactored some