some mild refactoring, convert tabs to spaces