refactor to Semver class. Add output format option