remove primitive pattern match

Also cleaned up writerstack to get rid of unused return of current
writer