Lithium insertion in layered materials as battery cathodes