Custom folding classes moved to platform, other refactoring