removed ergmahgad function