Refactored using module pattern