updated code to be in synch with Leo