Started as homework, but I put extra time and energy in it.