Optimum merging

a few small bugfixes/corrections