sort out indents and add some docs