fix P5each for hash and implement it for lists