VB-5 Rewrite and code changes