First working version of insert with balancing.