int functions finished, with a few "-k" operations to be replaced by "~k +1"