Teach run loop

Fix #171