big move, almost implement image generation part