refactor by use loop
Merge pull request #25 from wingyplus/master

Refactor by use for to loop round