Fixes #133
Fixes #162
Merge pull request #166 from kkasravi/issue_145

Fixes #133