Refactored sample view and edit