Changed code as per comment given by priyanka