Refactored the code in the manage client-side code.