Added pattern editor code