Moved platform specific code into util file