Put in additional log statements and fixed minor bug