load and calculate layout