Added auto-folding support, started templates