Misc. fixes and improvements (gotta love these commit messages)