Refactored

General refactoring of the code for PEP 8 style and to move some
functionality into methods rather than in the main loadedict2dic method.