util function to mark current position