Even more coverage. Moved functions to Jig namespace to allow easier testing and avoid any name conflict.