first version of remaping colors, still a bit slow