logic to detect shadows in the background
some code clean up and comments