DKS - rearranged code per @jzaefferer's request and added an expect value to allow a merge onto QUnit.