adding spaces and removing excess brackets