Added functions for xta and refactored tests