I seem to have changed more, for instance the whole positioning logic needed to be enhanced to take paddings into account, and put into a function to be called when the window resizes.