Merge pull request #965 from am11/master

Extract to file with import directive (#964)
Code: Reuses a variable.