Refactored some modules into classes