Working code untill the answering phase