saved open files
Refactor - Book sample code

Add the code found in the book for Best Practice in Titanium