Only update metadata that has changed
Organize conditionals in a better order