Added error messages and function descriptions.