Added debug messages and extra error messages
removed debug msg