Function edited

Function edited to have return values and proper arguments and
parameters.