Created index-of function to avoid using vector's .indexOf method all around.