added while loops to stop unrecognised responses