Refactoring console runner to facilitate testing