add method can be called with an array now
optimize index