The same bugfixes as before the revert, but now with proper indents