Refactoring the VGA driver