Merge of layerwise work and changes to cascaded trainer