Changed to functions, and check os before running the program