refactoring
k3dist: Fixed type error and some refactoring
More refactoring