Fixed code related issues and removed unused exception
Merge pull request #463 from sheebans/master

Fixed code related issues and removed unused exception