Use local variable instead of global
Use partial instead of layout
Merge pull request #15 from avokhmin/master

Refactoring and small changes