Schema management refactoring. Hopefully finished..