Wrote some horrendeous code for the last question. Not done yet.