Minor bugfix

Mainly just reformatting code and making minor adjustments