angularJS pattern improvements