rewrite some functions and add sixel drawing function