Add ahead/behind counts
Add detector for detached head state