added code for background subtraction (not tested yet)