restructure the program and redefine lamda seqence