Base code for new version