Fix integer division bug and sort out the centre pads vertically function