added predict and other functions