Can we do a bit of a refactor so this doesn't have to depend on page dimensions?