Separated functionality into app and server scripts.