better program structure and better logs