Code improvements for 189 - generalize in K