Improved code with better design and structure.
Updated some stuff