Fixed up

Bulk of code moved into log error