fixed: sort now in decreasing order
+ some refractoring
+ snippet generation - changed methods