cleaned up platform-specific code