updated to work regardless of how far up the offset parent was