Updated some comments and error logging