Changes caused due to removing seg faults using valgrind