Implemented more exception handling