Added removal of trailing spaces and newlines from output