Minor Refactor

Adjusted to PSR standards. 

Cleaned up code to be slightly more readable, and extendable. Not tested.