Refactored most of the bridges to avoid resource leaks during crashes during creation.