d
add dictionary
add multithreading and remove magic numbers