Fix: use foldr instead of reverse . foldl