Better splitting (was cost of splitting estimation)

See #77.

Contains console.log() calls, to be removed.