Updated the getVar method