small refactoring flask app