example code for ks