Added var and if statement