small modifications in the code