remove erroneous if statement in same function. Sorry for rubbish coding