Smarter positioning of menu