constructor handles dictionaries