homework (without flatten fn)