Modified code so it will compile under linux