functional version with items 1+2 done