Changed the sort to a stable sort: this prevents entities with same drawing order overlapping each other randomly