Core pr 4

Updated coding style and documentation.
Merge with PH libraries.

With the final comment taken into consideration we can conclude that there is a reason for the structure. Given the thorough digging required to reach this conclusion it would be nice with a explanatory comment.