implemented #6, support upsampling now