code cleanup, better indent logic