Comments, formatting, some string changes and error handling