put the indentation loop into a subroutine