Trail.isBefore/isAfter, bugfix: rewrite of Scene.insertLayer to use painted trails instead of pointers