[JS_MERGESORT]: Minor code improvements and abstraction