remove some unused variables,add density bound