Fixed code duplication in extensions