updated stem match algorithm, removed unnecessary optimization code, updated spec