added update_kpap and Line functions