Start of conversion to use flask