refactored result checking