New function IAMax().
Added size checking.