error handling and comments added