simplify the image
Fix some bugs simplify the logic