Parametrized JSON file name, some small refactoring