VID-1976 cleanup and bug fixes