Moved the update to k, as suggested by Andre