converted tabs to spaces
implemented writeToFile with tests