refactor API & angular application to improve performance