modified with matix table having constant size