Magical exceptions stuff. Not sure it'll work yet.
Template and some small fixes.