Implemented flagging and unflagging.

Fixes #31.