Improved sample request clearing function, added better commenting.