Function

Modified code slightly so it would be a function