Added function markEnd()