Got Segmentation Fault working finally