refactored page with flask