integer version
Modified code so it will compile under linux