Main program as a callback