Fixed remaining tests plus some cleanup.