add threshold and convert indentation to spaces