refactored to use module