Divided in two lines to a better understanding of the code.
Switched "if" to "try", so we don't have to run the functions two times.
Some tweaks to improve code reading.
The code is now fully commented.