Made more modifications to enable port to C