Merge of layerwise work and changes to cascaded trainer

Rebase+squash seems to have left the wrong commit author...