Updated to allow in-place signing, rather than atomic-replace