Fix some logic; clean up vim.