added more documentation and fixed typos