Code done in Python 3.4