first try to rewrite with AngularJS