updated to include more debug output