success so far with the extra type variable
actually, this is pretty functional