todo: maximization algorithm