first commit of the code from Jayant