copy and based from work vim