modify a sample code for KSR