Changed to functions already provided. Tested on windows