Added saving and loading of patterns from a file