Updated for KewPa 17 and Kewpa20, with minor functiona fixes