Added sorting back to select elements
Added easier support for subclasses of entities