modified bottom-up to use frontier routine