Added debug messages to main