Split core functionality out into package

Remove dependency on `fancyhdr'
Add lots of formatting options