some code reshuffling and renaming of variables, for readability
add variables for readability
fix the background subtraction