refactored sample register