reorganizing client code