-Tested rowind
-tested pid, now working correctly