Added an MIT license to main.py
Added a dedicated license file
Added better commenting to the code
Removed duplicate code