Wrote a point free version

Also added comments