Added error handling.
Merge branches 'master' and 'adderror'