Modified code to facilitate multiple gpus, and removed some error statements