add main program; working OK