changed agent code, need to fill in commented parts