changed up exception handling