This diff focuses entirely on:
- Renamed files to more meaningful name.
- Moved large codes to their individual new file to make main file small, clean and readible.
- Generealised code and made common files for repeated elements.
Comments in the diff will make it easy to follow up with all the changes.