Initial working version, tested on Windows