Made some modifications in code structure.