Some preliminary changes that are part of making the library reliably detect xid devices using the PST/e-prime protocol. Additionally, fixing a loop, renaming a few functions for clarity.

BugzID:3399