Finally functional, with output to device dpi (high resolution)