A buncho changes to make it work