refactory client