refactor to get away from sessions