Loop extension pull request

Hi all,

This is the pull request for the adding the loop extension code.
You can review and comment on it.

Regards,
Taj.