Split predict_profit function

And add unit test for it