some changes
Added debug messages