almost done, need to debug in out files