Extract method from main to class Renderer