Optimization.

Added coherent error checking logic to the main code line.
:smile: