replaced almost all logics with AngularJS. fixes #32