Added foreach frame function.
Expand comments