rewriting the vis code