Fixed issue with optional params
added tests