added support for basic looping