added bad pixel mask
conflicts
changes to code