Refactoring for predict functions and check_resource errors