Code cleanup and fixes in nearly all files