Refactoring

Move dithering code into module.