Fixed porosity calculator and added porosity tests