Refactoring the code
Make local import work on python2 and python3