Added a fair bit of comments, moved the message passing to be faster
(untested). Now realise I have to fix the row allocation..