Moved Log function before main scripts