Added down and up sampling