Fixing small errors and formatting, addition of further documentation in code