[refac] use module idiom to prevent global namespace pollution