added checks and prints of errors, corrected grammar in comments