Finished code. I think.