Reorganized Master client code