Code cleanup and refactoring
Fixed some typos
Fix for problems in recognizing the corrent message upon reception
Message received handlers implemented