Cleaned up the client code some