Move helper function to own file
Fix issue with body shifting and modal dialogs