functions for ordering divs correctly