most functions changed to angularjs