refactoring and removing an unnecessary call to compute prediction