Experimental

I changed the message parsing in aim to encapsulate the code with a C++ wrapper. I changed a bunch of other things (the event loop for instance) for the same goal. I fixed few bugs and i hope i did not introduced new ones.