added write test in front of Kg assignment