Added entity sorting by layer