finish chapter function