normalise indentation
fix trailing spaces
add some console attaching magic