Making some general improvements to functions and documentation