refactoring & removal old unused code