refactored everythinggg