first attempt to integrate KWS. not fully working yet