Code review!

Hi Santi! @brannerchinese and I did some code review and this is the result! We introduced some bugs early on, but I think we squashed them in the end.