added win32 version of strdup, cleaned up code