Some tidying up of model stuff and more debug code
Log errors to stdout