Rough solution (done in-class)