copied code from stage 5 for baseline