Major overhaul of client code