used built in ruby method for Hash and Array