Added some refactoring [CI SKIP]