preparing to divide
completely rewritten, wip
reimplemented, needs to be tested