removes extra 'if'