some code refactoring due to inspect code