allow state to be saved between requests and also remove usage of to_dict