changed the code structure.