comments added & error handling