Added upsampling and downsampling