Refactored completely everything