Refactor variable not found error handling to helper class