Refactored flaskapp