added predict logic