Fixed indenting and cleaned up if clause