added debugging method for neighbourhood
some minor comments for debugging added
fixed bug with clamping 8 times
added some comments to detail output
added matlab workspace, so smoothing step is not necessary