client side refactoring