Moved $scope function call out of Layer prototype.
Corrected result formatting.