refactor prediction