Refactored Angular code in client