Layout calculations and navbar fixes