Refactoring, quantization speed test.

Moving code into module. Testing speed of recolouring/quantizing
images. Fastest if rewritten in c.