Refactoring

Refactoring. Add 'frames' function.