code now uses function statements