Refactoring some code, added JsonUtils (removed code from a test)