change from class to plain def functions