Updated the source code to be more independent of the platform