removed unused code. updated comments