Fixed null pointer error and updated documentation.