Refactored using Revealing Module pattern