I've done this project about 2-3 years ago when i wasn't that good at coding, SO DONT JUDGE ME BY THIS CODE Its not even properly named cause this was a fast 20 minute rushed project i wrote back in the days.
Hope this helps..
PS: Yes, i keep all the code i write (all 100mb+ of it over the past years)