Adding more documentation and fixing initialisation bugs.