Refactoring. Apply module pattern