Reorganize and improve client