Refactored to use companion objects