handle spaces and tabs correctly