Allow configureable repeat, refactor with tests

also add run_tests.sh and travis
Merge pull request #19 from alphagov/allow-configureable-repeats

Allow configureable repeat, refactor with tests