Finished creating function and tested.