changed utitlity function and added copyright notice.