refactored some shit