Fixed code related issues and removed unused exception