Lots of fixes and some style conformity changes