Separate main method from server