Lots of changes, check the commit for specifics