use braces for single if; fix return before ref--