PTX done, not fully tested.