refactored to use require properly