All of this should probably be in a separate library as well, so we don't have to use it in the Gallery app.