Added plot after merging belonging regions. Cleaned up code.