added comments and included a function

for finding the length of a vector