Code clean up (see description)

Mostly style clean up but there are some logic clean ups here and there.

When accessing a variable from another class use a getter. Feel free to
access global variables from inside a class directly.