SDM: - Encapsulated sampling a bit

- Moved a few functions to free functions