Cleaned up PlatformManager and related code a bit.