Fixed sorting of spaces and also removed some debugs.