add versioning logic and tests