Put sampling functions back in (yet to be tested)