Done some refactoring and cleaning following pylint advices