move some processing down where it may not be needed.
improve style.
fix ng-repeat breakage.