redid python code into classes