optimise sample