Added create dictionary method

Moved dictionary creation to its own method.