added analysis code for background