BEGIN/END marks, tweaks, off-by-one fix