further minor refactoring to KWS code & tests;