=arch improvement & some refactoring