Remove redundant unused variables some redundant commented out code, add snippet to count the rows