Implemented handling of possible client states.  Refactored client creation in a reusable way.  Split up ScanTreeForClients into a bunch of more specialized functions.