Show complete error in output. Showing complete file path - sed command may need to be revisited.
Separate out some definitions into reusable files (without start tags), start validating for loops.