using editor settings to choose between tabs and spaces + refactored