Framework for sample handling