Added code to functions

Code added to functions based on vector example included in assignment.