Refactored main into runner