Tidy up a little, add comments