added win32 compatibility and long filename support + clean up