Replace leading 0 to numbers, and newlines by spaces. Some code moved to __init__.