closing functional code