I used the medley function