Made necessary changes to compile with gcc.