Added code for density and histogram