refactored stacking routine. Approx fit to the screen dims