Handle validation errors while creating programs
Refactor program validation