pushed layer code to a LayerParentModel to make it ng-repeatable as well as easier to test