Refactored into external package