Making the code modular.

Made the code modular by breaking HTMLelement and IMG classes into different methods.