removed $scope.glue and added online solution verbatim