Added predict and some small fixes