Updated makediag* functions.