A bunch of changes and fixes