Miscellaneous tweaks

Improved exception messages, use assert calls instead of raising
exceptions on object validation, new number recognising FSMs, use
decorators for lego piece reduction.