Extracted the main into a class