Add ELSIF to WHILE statement and fix some bugs