works on arrays and hash