updated to run on 3 outputs