Added documentation and error checking