Changed the if else if code again to link previous variable into the if else if conditional.