Fixed issue with optional params
added tests
Merge pull request #22 from fetch/added-test

Added unit tests , thanks @koenpunt