Some exception handling added
More test cases added and some more exception handling