Minor tweaks.
Add layer sorting support.