Refactored router, and DRYed up header.