I know it's not yours, but setting variable within function call plus within if is a bad practise