Refactor #4003: Samples refactored with position getter/setter and bug fixes