Simplify updateLayername
Enforce layer order whenever changes are made.
Merge branch 'master' into source-ui-test