refactor main into another class