add spaces and clean redundancies