refactoring into a gem
refactored run code into test
moved test code to example
refactoring for gem