Added JSONMessage and some comments + code cleanup
Code cleanup