Move calls out of foreach
Merge pull request #3 from sunnyratilal/unit-tests

Move calls out of foreach