Fix brackets and remove unused VARs