Improved exception handling and added few more test-cases