Small optimizations and formatting clean up

Moved all variable definitions to top of `inject`. Small optimization to `getStylesheet` (use defined `self.stylesheet` rather than repeating definition).

Clean up code formatting and spacing to be more consistent and (hopefully!) readable