Added a fix where empty elements wouldnt move to next page even if they overflowed. Switched method for determining if content overflows, taking padding into account