Fix #1353 and #1354, kick off a "helpers" module with general helper functions and extract out selection functions into there with a "decorate" function to easily add functionality to a $scope.