now with working loop!