ext checking added; refactoring