Implement basic downscaling support.
Better memory performance
Cleanup + const qualify more variable