General cleanup

Update an exception hierarchy, use unique_ptr, and remove an unnecessary iostream include.