Adds error reporting, header and comments