Final source code for app and server