Fixed the Torres function, and handle multiple systems better