Added upstream and some more modifications