refactoring && optimization