Added dilation and erosion