Add header decode and tests, make cart public so it's testable