updated flask code so it actually maybe works