Code fixes and clutter cleanup