Added checks for valid responses