refactor the foldRight to oneline version