factor code into classes
update example notebook