+1 for these changes. The ifs w/o {} have been bothering me