Refactor to use OrderDict as symbol tables and retrieve vars