Fixed bracket fuckups and logic problems

I suck at this.