Updating to ensure_resource rather than if ! defined