Add version tracking and fix database issues