pigjar-56. Refactored to remove circular module dependency. Unittests moved to matching test modules.