Modified for compatibility with Windows