updated predict method