updated to look for K at end