Introduced target mask. Refactored the clear() interface.
Fixed all the examples to run