Completed edits to the function script.