st: sorting with a key

Hi again guys!
I wish to say 2 things. The ado file which I posted earlier is much
faster than looping manually in stata.
Also the original sortrows has some checks and balances which I
removed to clarify the main programming goal in my mind plus I only
started doing MATA yesterday.
I want to make one improvement. Sortrows allows me to say
sortrows(var*)
I want to say keysortrows(var*), key(k*)
How can I make this improvement ? Please give me a hint.
Thank you,
Ashim.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/