added filter to ng-repeat to make the order reverse, and did some refactors