Some code cleanup, mostly by adding an easy way to check for a space being empty.