Refactored error program definition