Refactoring to allow platform-specific behavior