WIP: fixed session and header logic