Implemented Dictionary logic, possibly out of memory problem