Removed some OS hacks with modern functions.