Added preprocessor directives for crossplatform compatibility