extended the vis() method to take a callback function