Updated comments and fixed broken error reporting