Fix incorrect blurring around the edges

Includes @bryanjclark's updated code