remove() function does not clear elements array now