Fix function reduction

Signed-off-by: Rick Taylor <rick@tropicalstormsoftware.com>
Now with const and some much better reduction

Signed-off-by: Rick Taylor <rick@tropicalstormsoftware.com>