Cleaned up a bit, more portability.