Added comments and debug flag for msgs