Updated to make the vim code a little more flexible