some methods are updated
sorting bug in layer is fixed

std::sort makes error when using '<=' for comparison