Refactor to allow reuse of classes and methods