some modifications in the code