move code from Server_app to modules