Added all the code from the linux version - loads of errors - begin the bug fixing \!