refactoring & improvements