Some unused code commented, and unnecessary conditions removed