Started fixing a bug with the masking code, and also added some stuff to the manual.