Fix some brackets.
Massive changes/improvements.