refactored using revealing module pattern