A new approach to statement validation

This needs testing!