working on Pattern serialization
Pattern state take 2