added rankagg fxn, addresses #156