Refactored sample method and moved from SheetStack to Stack

Changes were needed to pull out general components from sample
method to allow sampling of different Stack types, e.g. TableStack,
which will soon be introduced.