redesign the messageloop and make it run