Work on AG backend code

Some progress. Working out a timing offset bug.