reduce sample code