refactor code in customer mode for external?
Cleanup code