[Master] Minor improvements

Some type hints and decrease of cyclomatic complexity.

This is just a proposal. Fell free to close. :)
Merge pull request #325 from KennedyTedesco/master-minor

[Master] Minor improvements