Loop support

Added loop support.