Improve error messages
Add comments