mainServer now returns error for testability