Refactor main to start and provide a class