Template functions update and mark.

Template functions update and mark.
A more effective function mark.