Reworked app to angularjs