Refactored in vispy.js file.