revised cpu version works. will now compile gpu version