Reasonable error messages when model expansion fails
Clean up
Cleaned code
Trying to sort out #217