implemeted predict functionality