simplify indent code.
minor tweaks to helper functions.