Refactored

Put everything in an object