Added density calculation