Reduce debugging output
Improve slightly handling of failures
Fix bug in type inference

This was because I misinterpreted a (confusing) slide from te source.