more generic implementation for the popup menu, because i will need it.