From http://stackoverflow.com/questions/77434/how-to-access-the-last-value-in-a-vector