added some comments and made an error message better