Refactored the entire module