Added app_port config item
Cleanup and bugfix config.