refactored some nonsense