Wrote a point free version