refactor card bmp code.
refactor code to speed up loading