refactored to use revealing module design pattern