Modified get flows/heights to return tuples. Tidied-up main script