Added function g with two usage options.

1) Constant function: Set usage = 1
2) Expectation function: Set usage = 2;