refactored plugin and introduced hierarchical sorting
merged changes