Working code upto the answering phase