Cleaning up VWI code. Adding some documentation.