refactor kiva-update.py

Signed-off-by: Chee Sing Lee <cheesinglee@gmail.com>