removed  debug code, unused vars