Added debug and few functions