Modified to cope with huge array