updating with sorting of layers and fixing classify field method for integers