Add update hook to migrate old config. Fix minor bugs.
Moved logic into a class.
Super small bug fix.
The images now uses state api to store data since it shall not be exported. This means existing images will disappear.