Refactored to use a module