added comments
removed dead debug code