Coupling the structure evolution and the oxygen redox electrochemistry in layered transition metal oxides