added densities function