Add in some code to help debug afmotion