Further code added to support fragments.