Extern functionality added. Refactoring