Code cleanup (commit: 8bacd9c)
Applying optimization while selecting entities with criteria for single-table polymorphism case (commit: f1fb242)