working on clean gpu implementation