Turn generator into lib and use it in update.dart

Working put needs some clean-up, don't merge just yet.