change sorting; var refactoring related to bug 869087
Merge pull request #9 from ednapiranha/bug869087

change sorting; var refactoring related to bug 869087