Generic buttons code improvements