New '.cast' template
Fixes and tests