Added a test-specific subclass and refactored bayesian json writer to improve testability