dict logic