Updated chapter editing code