Fixes for Vim and refactored common methods