Re-instated error checking. My previous commit worked flawless