Modified domain function to include calculate.density as an explicit parameter.
Also changed order of arguments in strat to reflect order in domain