Changed it to run on the GPU and fixed some errors.