improved example by using block copies instead of loops