Add more documentation and minor fixes