Separate VCS-dependent code from general functions
Add tests