Cleaned up patterns.nim file. More info below.