Changed to binary masks.
Added destructor.