Updated various functions from v1 to v2 methodology.