Improve header reading