added more comments and removed error messages