added many peter changes
 added more message functions