start writing balancing alg