added function to calculate specific gravity