Larger restructuring of code simplifying and generalising mesh update. Also introduced amplification option and writePositionsToLogFile option