Made various IntelliJ improvements (for each loops, removing unused variables)