some cleanings and tweaks + 1 bugfix (case 5 in insertion wasn't using the correct grandparent)