Removing whitespace BEFORE checking if it's empty