Factor out generic call to main