add indent handling
minor refactoring