Added error handling in the pattern writer.
Tested and validated the pattern writer.
Continued the pattern loader but a lot of things need to be done for the gauge values...