Refactor zvsh

need to refactor a couple of things to write better tests