Fixed some leaks, fixed ambiguity in if/else using {}, pre-drastic change commit