Extract buttons code into a separate file