move to generalised extensions

This converts the extensions into functions that can apply to any loader.