main integrated with gui