Implementing background subtraction