Exposing more features to the header and some small improvements/refactorings