Code modified. Implemented Dictionary concept to the code.