clean up output logging, add index