duplicate code refactored to functions
Merge pull request #1 from OniQ/master

duplicate code refactored to functions