Better parsing of whitespace (plus minor rename refactoring)