restructuring for production code