Revert a lot of things and added some fixes