Refactored for integration with composer