Proper exception handling