moved command sequence handling to frame function in preparation for some state/io work