Versioned api

This PR contains the changes required for the new versioned API.