add flask security and better structure