Debug version of function run