initial go at moving the ksm to use flask