Convert backend to flask, clean up front end models