cleaned up debug and run functions