Main loop skel constructed
some improvements